<template>
  <div class="TreeSelect1">
    <div class="coent">
      <van-tree-select @click-item="handleData" height="94vh" :items="items" :active-id.sync="activeIds" :main-active-index.sync="activeIndex" />
    </div>
    <div style="margin-top: 2px" @click="handleGoToNext">
      <van-button type="info" block>下一步</van-button>
    </div>
  </div>
</template>
<script>
import { QuerySignCallback, CreateProcess, dataServerOpenDataView, updateDataView, FileServerProxy, ExecProcedure, sendBusinessMessage, IfMapToResult, IfMapToApplyEdit } from '../../utils/api'
import { houseCraftsmanprojectSave1 } from '@/utils/GJSave'
import { GJDBFunction2 } from '@/utils/queryData'
import { houseCraftsmanprojectSave } from '@/utils/api'
export default {
  data() {
    return {
      items: [],
      activeIds: [],
      activeIndex: 0,
      tableData: [],
      indexData: [],
      tableData1: [],
      ids: 0,
      code1: '',
      ifMapType: ''
    }
  },
  mounted() {
    if (ZWJSBridge) {
      ZWJSBridge.setTitle({
        title: '选择人员'
      })
        .then((res) => {})
        .catch((err) => {})
    }
  },
  methods: {
    getData: async function (data) {
      debugger
      let me = this
      if (data !== '') {
        let params = {
          taskId: data,
          direction: 0,
          token: window.localStorage.getItem('token')
        }
        let params3 = {
          accessCode: '0a709d649c314903a72225edb8bc8c2a',

          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: params
        }
        const res = await FileServerProxy(params3)
        var newResData = JSON.parse(res.data.data)
        me.tableData = eval('(' + res.data.data + ')')
        //wjh 三个经办人发送给负责人 掉新的接口，加判断是为了不影响原来的
        if (me.$route.query && me.$route.query.iszjsh == 1) {
          //父树
          newResData.SendData.forEach((newItem) => {
            if (newItem.PTNID == '-1')
              me.items.push({
                text: newItem.TEXT,
                WFNODEGUID: newItem.WFNODEGUID,
                dot: false,
                TNID: newItem.TNID,
                PTNID: newItem.PTNID,
                // 导航节点额外类名
                className: 'my-class',
                // 该导航下所有的可选项
                children: []
              })
          })
          let I_ZJCITY = ''
          if (me.$route.query.data && me.$route.query.data.BUILDTYPE == 14) {
            I_ZJCITY = me.$route.query.data.VILLAGE
          } else {
            I_ZJCITY = me.$route.query.data.CUN
          }
          //存储过程赋值
          if (me.$route.query.data.NODE_GUID == '{5821E9EB-44B5-49AC-A659-6DF98B410B38}') {
            //农房负责人
            let xcfycjtex = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 7 }]),
              token: window.localStorage.getItem('token')
            }
            let xcfycjtfn = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',

              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: xcfycjtex
            }
            const resxcfycjt = await FileServerProxy(xcfycjtfn)
            let dataxcfycjt = JSON.parse(resxcfycjt.data.data)
            dataxcfycjt.Data.forEach((item) => {
              me.ids++
              me.items[0].children.push({
                text: item.ST_NAME,
                id: me.ids,
                USERID: item.ST_ID,
                USERNAME: item.ST_NAME,
                WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                WFNODENAME: newResData.SendData[0].TEXT,
                TEXT: item.ST_NAME,
                PTNID: newResData.SendData[0].TNID,
                TNID: me.ids + 1,
                ISUSER: 1,
                SINGLEASSIGN: false,
                WFNODETYPE: newResData.SendData[0].WFNODETYPE
              })
            })
          } else if (me.$route.query.data.NODE_GUID == '{417EFF61-5FA8-44D6-A624-5B3D0F39B56C}') {
            //资格负责人
            let zgfzrex = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 5 }]),
              token: window.localStorage.getItem('token')
            }
            let zgfzrfn = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',

              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: zgfzrex
            }
            const reszgfzr = await FileServerProxy(zgfzrfn)
            let datazgfzr = JSON.parse(reszgfzr.data.data)
            datazgfzr.Data.forEach((item) => {
              me.ids++
              me.items[0].children.push({
                text: item.ST_NAME,
                id: me.ids,
                USERID: item.ST_ID,
                USERNAME: item.ST_NAME,
                WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                WFNODENAME: newResData.SendData[0].TEXT,
                TEXT: item.ST_NAME,
                PTNID: newResData.SendData[0].TNID,
                TNID: me.ids + 1,
                ISUSER: 1,
                SINGLEASSIGN: false,
                WFNODETYPE: newResData.SendData[0].WFNODETYPE
              })
            })
          } else if (me.$route.query.data.NODE_GUID == '{0439EC7A-785D-4B5B-ADD4-11E2D320376E}') {
            //规划负责人
            let ghfzrex = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 6 }]),
              token: window.localStorage.getItem('token')
            }
            let ghferfn = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',
              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: ghfzrex
            }
            const resghfer = await FileServerProxy(ghferfn)
            let dataghfer = JSON.parse(resghfer.data.data)
            dataghfer.Data.forEach((item) => {
              me.ids++
              me.items[0].children.push({
                text: item.ST_NAME,
                id: me.ids,
                USERID: item.ST_ID,
                USERNAME: item.ST_NAME,
                WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                WFNODENAME: newResData.SendData[0].TEXT,
                TEXT: item.ST_NAME,
                PTNID: newResData.SendData[0].TNID,
                TNID: me.ids + 1,
                ISUSER: 1,
                SINGLEASSIGN: false,
                WFNODETYPE: newResData.SendData[0].WFNODETYPE
              })
            })
          } else if (
            me.$route.query.data.NODE_GUID == '{299D1B2C-4EDA-4963-AC66-E91B3403A49E}' ||
            me.$route.query.data.NODE_GUID == '{97E3145A-01B9-4CEE-AA4E-21CA9F0FF671}' ||
            me.$route.query.data.NODE_GUID == '{777D7530-351F-4BAA-8A28-9153C53A4BBE}' ||
            me.$route.query.data.NODE_GUID == '{9766D96E-8B85-481F-B514-C0B21CF4DC3A}'
          ) {
            //wjh 三个负责人发送给批前公式
            let spendexpqgs = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 25 }]),
              token: window.localStorage.getItem('token')
            }
            let endfnpqgs = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',

              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: spendexpqgs
            }
            const reendferpqgs = await FileServerProxy(endfnpqgs)
            let datendferpqgs = JSON.parse(reendferpqgs.data.data)
            //需要先判断datendferpqgs.Data.length是不是大于0 等于零 要调用另一个接口回去人员信息
            if (datendferpqgs.Data.length == 0) {
              let params = {
                dataguid: '9fcdac62-337a-42a2-ab01-1f3c4bc117cd',
                searchObject: JSON.stringify([
                  {
                    field: 'PROC_GUID',
                    value: me.$route.query.data.PROC_GUID
                  },
                  {
                    field: 'NODE_GUID',
                    value: '{5E1AD806-7824-4196-8ADF-E231A8704FD3}'
                  }
                ]),
                token: window.localStorage.getItem('token')
              }
              let params1 = {
                accessCode: '688bd3883572440a859dfd8ba9194e7b',
                cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
                params: params
              }
              const res = await QuerySignCallback(params1)
              let firstData = JSON.parse(res.data.data).Data[0]
              if (res.data.code == 200) {
                let paer = {
                  procName: 'USERNAME',
                  dtParams: JSON.stringify([{ I_USERID: firstData.TASK_RECIPIENTLIST.split(',')[1] }]),
                  token: window.localStorage.getItem('token')
                }
                let params4 = {
                  accessCode: '69db6bece3a7480592e2ec753d1e335e',
                  cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
                  params: paer
                }
                const req = await QuerySignCallback(params4)
                var xctk1 = JSON.parse(req.data.data)
                if (xctk1 && xctk1.Data.length > 0) {
                  xctk1.Data.forEach((it, index) => {
                    me.ids++
                    me.items[0].children.push({
                      text: it.USERNAME,
                      id: me.ids,
                      USERID: it.USERID,
                      USERNAME: it.USERNAME,
                      WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                      WFNODENAME: newResData.SendData[0].TEXT,
                      TEXT: it.USERNAME,
                      PTNID: newResData.SendData[0].TNID,
                      TNID: me.ids + 1,
                      ISUSER: 1,
                      SINGLEASSIGN: false,
                      WFNODETYPE: me.ids
                    })
                  })
                }
                console.log(me.items[0].children, 'efbhguifewufb uebu')
              }
            } else {
              datendferpqgs.Data.forEach((item) => {
                me.ids++
                me.items[0].children.push({
                  text: item.ST_NAME,
                  id: me.ids,
                  USERID: item.ST_ID,
                  USERNAME: item.ST_NAME,
                  WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                  WFNODENAME: newResData.SendData[0].TEXT,
                  TEXT: item.ST_NAME,
                  PTNID: newResData.SendData[0].TNID,
                  TNID: me.ids + 1,
                  ISUSER: 1,
                  SINGLEASSIGN: false,
                  WFNODETYPE: newResData.SendData[0].WFNODETYPE
                })
              })
            }
            //wjh 2022-0726(废弃)三个负责人发给乡镇人民政府审核
            // let spendex = {
            //   procName: "up_townaudit",
            //   dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 8 }]),
            //   token: window.localStorage.getItem("token"),
            // };
            // let endfn = {
            //   accessCode: "69db6bece3a7480592e2ec753d1e335e",

            //   cityCode: window.localStorage.getItem("citycode")
            //     ? window.localStorage.getItem("citycode")
            //     : "441300000000",
            //   params: spendex,
            // };
            // const reendfer = await FileServerProxy(endfn);
            // let datendfer = JSON.parse(reendfer.data.data);
            // datendfer.Data.forEach((item) => {
            //   me.ids++;
            //   me.items[0].children.push({
            //     text: item.ST_NAME,
            //     id: me.ids,
            //     USERID: item.ST_ID,
            //     USERNAME: item.ST_NAME,
            //     WFNODEGUID: newResData.SendData[0].WFNODEGUID,
            //     WFNODENAME: newResData.SendData[0].TEXT,
            //     TEXT: item.ST_NAME,
            //     PTNID: newResData.SendData[0].TNID,
            //     TNID: me.ids + 1,
            //     ISUSER: 1,
            //     SINGLEASSIGN: false,
            //     WFNODETYPE: newResData.SendData[0].WFNODETYPE,
            //   });
            // });
          } else if (me.$route.query.data.NODE_GUID == '{342312E7-E3BC-426A-8568-E5E4EDD94A1A}') {
            //批前公式发送给镇街人民政府审核
            let spendex = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 8 }]),
              token: window.localStorage.getItem('token')
            }
            let endfn = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',
              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: spendex
            }
            const reendfer = await FileServerProxy(endfn)
            let datendfer = JSON.parse(reendfer.data.data)
            datendfer.Data.forEach((item) => {
              me.ids++
              me.items[0].children.push({
                text: item.ST_NAME,
                id: me.ids,
                USERID: item.ST_ID,
                USERNAME: item.ST_NAME,
                WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                WFNODENAME: newResData.SendData[0].TEXT,
                TEXT: item.ST_NAME,
                PTNID: newResData.SendData[0].TNID,
                TNID: me.ids + 1,
                ISUSER: 1,
                SINGLEASSIGN: false,
                WFNODETYPE: newResData.SendData[0].WFNODETYPE
              })
            })
          }
          //竣工验收三个经办人、三个负责人
          else if (me.$route.query.data.NODE_GUID == '{5CC13346-8C53-4A37-989D-932716248754}') {
            //资格
            let ysghfzrex = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 14 }]),
              token: window.localStorage.getItem('token')
            }
            let ysghferfn = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',

              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: ysghfzrex
            }
            const ysresghfer = await FileServerProxy(ysghferfn)
            let ysdataghfer = JSON.parse(ysresghfer.data.data)
            ysdataghfer.Data.forEach((item) => {
              me.ids++
              me.items[0].children.push({
                text: item.ST_NAME,
                id: me.ids,
                USERID: item.ST_ID,
                USERNAME: item.ST_NAME,
                WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                WFNODENAME: newResData.SendData[0].TEXT,
                TEXT: item.ST_NAME,
                PTNID: newResData.SendData[0].TNID,
                TNID: me.ids + 1,
                ISUSER: 1,
                SINGLEASSIGN: false,
                WFNODETYPE: newResData.SendData[0].WFNODETYPE
              })
            })
          } else if (me.$route.query.data.NODE_GUID == '{74864380-8590-4F8B-BD75-942E08F04D81}') {
            //规划
            let ysghfzrex = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 16 }]),
              token: window.localStorage.getItem('token')
            }
            let ysghferfn = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',

              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: ysghfzrex
            }
            const yusresghfer = await FileServerProxy(ysghferfn)
            let ysdataghfer = JSON.parse(yusresghfer.data.data)
            ysdataghfer.Data.forEach((item) => {
              me.ids++
              me.items[0].children.push({
                text: item.ST_NAME,
                id: me.ids,
                USERID: item.ST_ID,
                USERNAME: item.ST_NAME,
                WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                WFNODENAME: newResData.SendData[0].TEXT,
                TEXT: item.ST_NAME,
                PTNID: newResData.SendData[0].TNID,
                TNID: me.ids + 1,
                ISUSER: 1,
                SINGLEASSIGN: false,
                WFNODETYPE: newResData.SendData[0].WFNODETYPE
              })
            })
          } else if (me.$route.query.data.NODE_GUID == '{7C289E35-88FC-4002-9B88-ED6F472CA872}') {
            //农房
            let ysghfzrex = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 18 }]),
              token: window.localStorage.getItem('token')
            }
            let ysghferfn = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',

              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: ysghfzrex
            }
            const ysresghfer = await FileServerProxy(ysghferfn)
            let ysdataghfer = JSON.parse(ysresghfer.data.data)
            ysdataghfer.Data.forEach((item) => {
              me.ids++
              me.items[0].children.push({
                text: item.ST_NAME,
                id: me.ids,
                USERID: item.ST_ID,
                USERNAME: item.ST_NAME,
                WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                WFNODENAME: newResData.SendData[0].TEXT,
                TEXT: item.ST_NAME,
                PTNID: newResData.SendData[0].TNID,
                TNID: me.ids + 1,
                ISUSER: 1,
                SINGLEASSIGN: false,
                WFNODETYPE: newResData.SendData[0].WFNODETYPE
              })
            })
          } else if (
            me.$route.query.data.NODE_GUID == '{EB7D42FE-320C-4A0A-9C98-3E9373898826}' ||
            me.$route.query.data.NODE_GUID == '{003E7696-65E6-432B-97A7-C95711D1D0E0}' ||
            me.$route.query.data.NODE_GUID == '{B6D1F2A1-ACF3-4894-948E-54B9BC1F059F}'
          ) {
            let ysendex = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 19 }]),
              token: window.localStorage.getItem('token')
            }
            let ysendfn = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',

              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: ysendex
            }
            const ysreendfer = await FileServerProxy(ysendfn)
            let ysdatendfer = JSON.parse(ysreendfer.data.data)
            ysdatendfer.Data.forEach((item) => {
              me.ids++
              me.items[0].children.push({
                text: item.ST_NAME,
                id: me.ids,
                USERID: item.ST_ID,
                USERNAME: item.ST_NAME,
                WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                WFNODENAME: newResData.SendData[0].TEXT,
                TEXT: item.ST_NAME,
                PTNID: newResData.SendData[0].TNID,
                TNID: me.ids + 1,
                ISUSER: 1,
                SINGLEASSIGN: false,
                WFNODETYPE: newResData.SendData[0].WFNODETYPE
              })
            })
          } else if (me.$route.query.data.NODE_GUID == '{41EE42C1-2F52-45C5-A05C-D2D3160DCE23}' || me.$route.query.data.NODE_GUID == '{FAFEF7FF-6294-489A-A5DF-53906712EBEE}') {
            //结束
            me.items[0].children.push({
              text: newResData.SendData[0].TEXT,
              id: me.ids,
              USERNAME: newResData.SendData[0].TEXT,
              WFNODEGUID: newResData.SendData[0].WFNODEGUID,
              WFNODENAME: newResData.SendData[0].TEXT,
              TEXT: newResData.SendData[0].TEXT,
              PTNID: newResData.SendData[0].TNID,
              TNID: me.ids + 1,
              ISUSER: 1,
              SINGLEASSIGN: false,
              WFNODETYPE: newResData.SendData[0].WFNODETYPE
            })
          }
        } else if (me.$route.query && me.$route.query.isqydw == 1) {
          //企业单位发送给三个镇街经办
          //资格经办人 调用存储过程获资格经办人
          let I_ZJCITY = ''
          if (this.$route.query.data.BUILDTYPE == 14) {
            I_ZJCITY = this.$route.query.data.VILLAGE
          } else {
            I_ZJCITY = this.$route.query.data.CUN
          }
          let zjjbrex = {
            procName: 'up_townaudit',
            dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 13 }]),
            token: window.localStorage.getItem('token')
          }
          let zgjbrfu = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: zjjbrex
          }
          const reszgjbe = await FileServerProxy(zgjbrfu)
          let datazgjbr = JSON.parse(reszgjbe.data.data)
          //规划审核经办人
          let ghjbrex = {
            procName: 'up_townaudit',
            dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 15 }]),
            token: window.localStorage.getItem('token')
          }
          let ghjbrfu = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: ghjbrex
          }
          const resghjbrbe = await FileServerProxy(ghjbrfu)
          let dataghjbr = JSON.parse(resghjbrbe.data.data)
          //农房审核经办人
          let nfjbrex = {
            procName: 'up_townaudit',
            dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 17 }]),
            token: window.localStorage.getItem('token')
          }
          let nfjbrfu = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: nfjbrex
          }
          const resnfjbrbe = await FileServerProxy(nfjbrfu)
          let datanfjbr = JSON.parse(resnfjbrbe.data.data)
          newResData.SendData.forEach((nodeItem) => {
            if (nodeItem.PTNID == '-1') {
              me.items.push({
                text: nodeItem.TEXT,
                WFNODEGUID: nodeItem.WFNODEGUID,
                WFNODETYPE: nodeItem.WFNODETYPE,
                dot: false,
                TNID: nodeItem.TNID,
                PTNID: nodeItem.PTNID,
                // 导航节点额外类名
                className: 'my-class',
                // 该导航下所有的可选项
                children: []
              })
            }
          })
          me.items.forEach((nodeItem) => {
            var maxtnid = 0 //获取tnid最大值
            var tnid = nodeItem.TNID
            let data = []
            if (nodeItem.WFNODEGUID == '{5CC13346-8C53-4A37-989D-932716248754}' && nodeItem.PTNID == -1) {
              //资格经办人
              data = datazgjbr.Data
            }
            if (nodeItem.WFNODEGUID == '{74864380-8590-4F8B-BD75-942E08F04D81}' && nodeItem.PTNID == -1) {
              //规划经办人
              data = dataghjbr.Data
            }
            if (nodeItem.WFNODEGUID == '{7C289E35-88FC-4002-9B88-ED6F472CA872}' && nodeItem.PTNID == -1) {
              //农房经办人
              data = datanfjbr.Data
            }
            data.forEach((zgjbr) => {
              var newItem = {}
              maxtnid = maxtnid + 1
              newItem.text = zgjbr.ST_NAME
              newItem.id = me.ids++
              newItem.USERID = zgjbr.ST_ID
              newItem.USERNAME = zgjbr.ST_NAME
              newItem.WFNODEGUID = nodeItem.WFNODEGUID
              newItem.WFNODENAME = nodeItem.TEXT
              newItem.TEXT = zgjbr.ST_NAME
              newItem.TNID = maxtnid
              newItem.PTNID = tnid
              newItem.SINGLEASSIGN = false
              newItem.ISUSER = 1
              newItem.WFNODETYPE = nodeItem.WFNODETYPE
              nodeItem.children.push(newItem)
            })
          })
        } else if (me.$route.query && me.$route.query.iscgs == 1) {
          //父树
          newResData.SendData.forEach((newItem) => {
            if (newItem.PTNID == '-1')
              me.items.push({
                text: newItem.TEXT,
                WFNODEGUID: newItem.WFNODEGUID,
                dot: false,
                TNID: newItem.TNID,
                PTNID: newItem.PTNID,
                // 导航节点额外类名
                className: 'my-class',
                // 该导航下所有的可选项
                children: []
              })
          })
          let I_ZJCITY = ''
          if (me.$route.query.data && me.$route.query.data.BUILDTYPE == 14) {
            I_ZJCITY = me.$route.query.data.VILLAGE
          } else {
            I_ZJCITY = me.$route.query.data.CUN
          }
          //存储过程赋值
          if (me.$route.query.data.NODE_GUID == '{BF5EBF92-26ED-46F4-A7E5-EFFDD7C8BE0C}') {
            //农房负责人
            let xcfycjtex = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 1 }]),
              token: window.localStorage.getItem('token')
            }
            let xcfycjtfn = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',
              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: xcfycjtex
            }
            const resxcfycjt = await FileServerProxy(xcfycjtfn)
            let dataxcfycjt = JSON.parse(resxcfycjt.data.data)
            dataxcfycjt.Data.forEach((item) => {
              me.ids++
              me.items[0].children.push({
                text: item.ST_NAME,
                id: me.ids,
                USERID: item.ST_ID,
                USERNAME: item.ST_NAME,
                WFNODEGUID: newResData.SendData[0].WFNODEGUID,
                WFNODENAME: newResData.SendData[0].TEXT,
                TEXT: item.ST_NAME,
                PTNID: newResData.SendData[0].TNID,
                TNID: me.ids + 1,
                ISUSER: 1,
                SINGLEASSIGN: false,
                WFNODETYPE: newResData.SendData[0].WFNODETYPE
              })
            })
          }
        } else {
          var str = ''
          if (me.$route.query.data.SQFS == '35') {
            str = "'" + me.$route.query.data.CERTIFICATECODE + "'"
          } else {
            let str1 = me.$route.query.data.CERTIFICATECODE
            let str2 = me.$route.query.data.DBRSFZH
            str = "'" + str1 + "'" + ',' + "'" + str2 + "'"
          }
          let paer = {
            procName: 'up_townaudit',
            dtParams: JSON.stringify([{ I_USERID: str, I_TYPE: 21 }]),
            token: window.localStorage.getItem('token')
          }
          let params4 = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: paer
          }
          const req = await QuerySignCallback(params4)
          var xctk = JSON.parse(req.data.data)
          //现场踏勘
          eval('(' + res.data.data + ')').SendData.forEach((item, index) => {
            if (item.PTNID == '-1') {
              if ((me.$route.query.CHDW && me.$route.query.CHDW.length > 0) || (me.$route.query.TKDW && me.$route.query.TKDW.length > 0)) {
                if (item.TEXT == '农户选图集、选工匠') {
                  return
                }
              } else if (me.$route.query.data.NODE_GUID == '{5E1AD806-7824-4196-8ADF-E231A8704FD3}') {
                if (item.TEXT != '农户选图集、选工匠') {
                  return
                }
              }
              me.items.push({
                text: item.TEXT,
                WFNODEGUID: item.WFNODEGUID,
                dot: false,
                TNID: item.TNID,
                PTNID: item.PTNID,
                // 导航节点额外类名
                className: 'my-class',
                // 该导航下所有的可选项
                children: []
              })
            }
            if (
              me.$route.query.data.NODE_GUID === '{67241083-CA60-43FC-B1C1-1F4A2D133184}' ||
              me.$route.query.data.NODE_GUID == '{5E1AD806-7824-4196-8ADF-E231A8704FD3}' ||
              me.$route.query.data.NODE_GUID == '{4BF99B6A-E6EE-4A47-B3AE-B9CD2DBD1F3E}'
            ) {
              me.items.forEach(async (node) => {
                //企业
                if (node.WFNODEGUID == '{517211B4-3740-4F49-9DA4-7BC3C9A6F9EA}' && node.children.length == 0) {
                  try {
                    if (me.$route.query.CHDW.length > 0) {
                      me.$route.query.CHDW.forEach((it, index) => {
                        me.ids++
                        node.children.push({
                          text: it.ST_NAME,
                          id: me.ids,
                          USERID: it.ST_ID,
                          USERNAME: it.ST_NAME,
                          WFNODEGUID: node.WFNODEGUID,
                          WFNODENAME: node.text,
                          TEXT: it.ST_NAME,
                          PTNID: node.TNID,
                          TNID: me.ids + 1,
                          ISUSER: 1,
                          SINGLEASSIGN: false,
                          WFNODETYPE: me.ids
                        })
                      })
                    }
                  } catch (err) {}
                }
                //何志龙修改  有问题  请先联系我
                if (node.WFNODEGUID == '{5AC94EA9-AC60-475C-B903-346B5E120400}' && node.children.length == 0) {
                  try {
                    if (xctk && xctk.Data.length > 0) {
                      xctk.Data.forEach((it, index) => {
                        me.ids++
                        node.children.push({
                          text: it.ST_NAME,
                          id: me.ids,
                          USERID: it.ST_ID,
                          USERNAME: it.ST_NAME,
                          WFNODEGUID: node.WFNODEGUID,
                          WFNODENAME: node.text,
                          TEXT: it.ST_NAME,
                          PTNID: node.TNID,
                          TNID: me.ids + 1,
                          ISUSER: 1,
                          SINGLEASSIGN: false,
                          WFNODETYPE: me.ids
                        })
                      })
                    }
                  } catch (err) {}
                }
                //现场踏勘 何志龙修改  有问题  请先联系我
                if (node.WFNODEGUID == '{67241083-CA60-43FC-B1C1-1F4A2D133184}' && node.children.length == 0) {
                  let params = {
                    dataguid: '9fcdac62-337a-42a2-ab01-1f3c4bc117cd',
                    searchObject: JSON.stringify([
                      {
                        field: 'PROC_GUID',
                        value: me.$route.query.data.PROC_GUID
                      },
                      {
                        field: 'NODE_GUID',
                        value: '{5E1AD806-7824-4196-8ADF-E231A8704FD3}'
                      }
                    ]),
                    token: window.localStorage.getItem('token')
                  }
                  let params1 = {
                    accessCode: '688bd3883572440a859dfd8ba9194e7b',
                    cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
                    params: params
                  }
                  const res = await QuerySignCallback(params1)
                  let firstData = JSON.parse(res.data.data).Data[0]
                  if (res.data.code == 200) {
                    let paer = {
                      procName: 'USERNAME',
                      dtParams: JSON.stringify([{ I_USERID: firstData.TASK_RECIPIENTLIST.split(',')[1] }]),
                      token: window.localStorage.getItem('token')
                    }
                    let params4 = {
                      accessCode: '69db6bece3a7480592e2ec753d1e335e',
                      cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
                      params: paer
                    }
                    const req = await QuerySignCallback(params4)
                    var xctk1 = JSON.parse(req.data.data)
                    if (xctk1 && xctk1.Data.length > 0) {
                      node.children = []
                      xctk1.Data.forEach((it, index) => {
                        me.ids++
                        node.children.push({
                          text: it.USERNAME,
                          id: me.ids,
                          USERID: it.USERID,
                          USERNAME: it.USERNAME,
                          WFNODEGUID: node.WFNODEGUID,
                          WFNODENAME: node.text,
                          TEXT: it.USERNAME,
                          PTNID: node.TNID,
                          TNID: me.ids + 1,
                          ISUSER: 1,
                          SINGLEASSIGN: false,
                          WFNODETYPE: me.ids
                        })
                      })
                    }
                    console.log(node, 'efbhguifewufb uebu')
                  }
                }
                //踏勘
                if (node.WFNODEGUID == '{4BF99B6A-E6EE-4A47-B3AE-B9CD2DBD1F3E}' && node.children.length == 0) {
                  debugger
                  try {
                    if (me.$route.query.TKDW.length > 0) {
                      me.QuerySignCallback(node)
                    }
                  } catch (err) {}
                }
                if (
                  node.WFNODEGUID == '{5AC94EA9-AC60-475C-B903-346B5E120400}' &&
                  node.children.length == 0 &&
                  node.PTNID == -1 &&
                  eval('(' + req.data.data + ')').Data &&
                  eval('(' + req.data.data + ')').Data.length > 0
                ) {
                  try {
                    eval('(' + req.data.data + ')').Data.forEach((items, index) => {
                      // 如果有测绘单位和踏勘单位需要在这里加上
                      node.children.push({
                        text: items.USERNAME,
                        id: index + 1,
                        USERID: items.USERID,
                        USERNAME: items.USERNAME,
                        WFNODEGUID: item.WFNODEGUID,
                        WFNODENAME: item.WFNODENAME,
                        TEXT: items.USERNAME,
                        PTNID: item.PTNID,
                        TNID: index + 2,
                        ISUSER: 1,
                        SINGLEASSIGN: false,
                        WFNODETYPE: index + 1
                      })
                    })
                  } catch (err) {}
                }
              })
            } else {
              //四到场流程
              if (
                item.WFNODEGUID == '{D2048C7B-88F9-453C-8FB9-6CFBE287634F}' ||
                item.WFNODEGUID == '{757359B4-6AC2-4860-899F-94A348EC0177}' ||
                item.WFNODEGUID == '{B3ACD6E6-CD10-42B4-9C36-B981DA0129E4}'
              ) {
                me.items.forEach((node) => {
                  if (
                    node.WFNODEGUID == '{B3ACD6E6-CD10-42B4-9C36-B981DA0129E4}' ||
                    node.WFNODEGUID == '{757359B4-6AC2-4860-899F-94A348EC0177}' ||
                    node.WFNODEGUID == '{D2048C7B-88F9-453C-8FB9-6CFBE287634F}'
                  )
                    if (node.children.length == 0 && node.PTNID == -1 && eval('(' + req.data.data + ')').Data && eval('(' + req.data.data + ')').Data.length > 0) {
                      eval('(' + req.data.data + ')').Data.forEach((items, index) => {
                        me.ids++
                        node.children.push({
                          text: items.USERNAME,
                          id: me.ids,
                          USERID: items.USERID,
                          USERNAME: items.USERNAME,
                          WFNODEGUID: item.WFNODEGUID,
                          WFNODENAME: item.WFNODENAME,
                          TEXT: items.USERNAME,
                          PTNID: item.TNID,
                          TNID: me.ids + 1,
                          ISUSER: 1,
                          SINGLEASSIGN: false,
                          WFNODETYPE: item.WFNODETYPE
                        })
                      })
                    }
                })
              } else if (
                item.WFNODEGUID == '{F81FCB82-7196-4E94-BFF5-159E1CEBEFF8}' ||
                item.WFNODEGUID == '{10BAEA52-EDDE-48C7-97AD-C211D272010E}' ||
                item.WFNODEGUID == '{C89D1E12-1303-482F-BB9E-45457905C759}' ||
                item.WFNODEGUID == '{DDCED543-65DD-4D6B-BEFC-B07DBDDA6C76}'
              ) {
                //基槽沿线
                me.ifMapType = item.WFNODEGUID
                me.items.forEach((node) => {
                  if (
                    node.WFNODEGUID == '{F81FCB82-7196-4E94-BFF5-159E1CEBEFF8}' ||
                    node.WFNODEGUID == '{10BAEA52-EDDE-48C7-97AD-C211D272010E}' ||
                    node.WFNODEGUID == '{C89D1E12-1303-482F-BB9E-45457905C759}' ||
                    node.WFNODEGUID == '{DDCED543-65DD-4D6B-BEFC-B07DBDDA6C76}'
                  ) {
                    me.ids++
                    node.children.push({
                      text: item.TEXT,
                      id: me.ids,
                      USERID: item.USERID,
                      USERNAME: item.TEXT,
                      WFNODEGUID: item.WFNODEGUID,
                      WFNODENAME: item.WFNODENAME,
                      TEXT: item.TEXT,
                      PTNID: item.PTNID,
                      TNID: item.TKDW,
                      ISUSER: 0,
                      SINGLEASSIGN: true,
                      WFNODETYPE: item.WFNODETYPE
                    })
                  }
                })
              } else {
                me.items.forEach((node) => {
                  if (item.PTNID == node.TNID) {
                    if (item.PTNID != -1) {
                      node.children.push({
                        text: item.USERNAME,
                        id: index,
                        USERID: item.USERID,
                        USERNAME: item.USERNAME,
                        WFNODEGUID: item.WFNODEGUID,
                        WFNODENAME: item.WFNODENAME,
                        TEXT: item.USERNAME,
                        PTNID: item.PTNID,
                        TNID: item.TNID,
                        ISUSER: item.ISUSER,
                        SINGLEASSIGN: false,
                        WFNODETYPE: item.WFNODETYPE
                      })
                    }
                  }
                })
              }
            }
          })
          //审核负责人环节重新定义人员结构''
          if (
            me.$route.query.data.NODE_GUID === '{299D1B2C-4EDA-4963-AC66-E91B3403A49E}' ||
            me.$route.query.data.NODE_GUID == '{97E3145A-01B9-4CEE-AA4E-21CA9F0FF671}' ||
            me.$route.query.data.NODE_GUID === '{777D7530-351F-4BAA-8A28-9153C53A4BBE}' ||
            me.$route.query.data.NODE_GUID === '{EB7D42FE-320C-4A0A-9C98-3E9373898826}' ||
            me.$route.query.data.NODE_GUID === '{003E7696-65E6-432B-97A7-C95711D1D0E0}' ||
            me.$route.query.data.NODE_GUID === '{B6D1F2A1-ACF3-4894-948E-54B9BC1F059F}'
          ) {
            let NODE_GUID = '{9766D96E-8B85-481F-B514-C0B21CF4DC3A}'
            if (
              me.$route.query.data.NODE_GUID === '{EB7D42FE-320C-4A0A-9C98-3E9373898826}' ||
              me.$route.query.data.NODE_GUID === '{003E7696-65E6-432B-97A7-C95711D1D0E0}' ||
              me.$route.query.data.NODE_GUID === '{B6D1F2A1-ACF3-4894-948E-54B9BC1F059F}'
            ) {
              NODE_GUID = '{41EE42C1-2F52-45C5-A05C-D2D3160DCE23}'
            }
            const res1 = await dataServerOpenDataView(
              'd0979119-5a29-4422-8cde-8ecde3d900dc',
              encodeURIComponent(
                JSON.stringify([
                  {
                    field: 'PROC_GUID',
                    value: me.$route.query.data.PROC_GUID
                  },
                  {
                    field: 'NODE_GUID',
                    value: NODE_GUID
                  }
                ])
              ),
              window.localStorage.getItem('token')
            )
            if (res1.data.Data.length > 0) {
              let str = res1.data.Data[0].TASK_RECIPIENTLIST
              let str2 = str.split(',')
              let paerss = {
                procName: 'USERNAME',
                dtParams: JSON.stringify([{ I_USERID: str2[1] }]),
                token: window.localStorage.getItem('token')
              }
              let params4s = {
                accessCode: '69db6bece3a7480592e2ec753d1e335e',
                cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
                params: paerss
              }
              // let paer = {
              //   procName: "USERNAME",
              //   dtParams: JSON.stringify([{ I_USERID: str2[1] }]),
              // };
              const req = await QuerySignCallback(params4s)
              me.repalceNodeUsers(res, req)
            }
          }
        }
      }
    },
    //村预审获取人员信息
    getCunYUshen: async function (data) {
      /**
   * 村预审获取人员的过程
   * 调用存储过程之前需要先根据这个  BUILDTYPE（从当前行获取）  字段  判
     断下是否是 14 ，如果是 获取当前行的 VILLAGE。如果不是  获取当前行
     的CUN。
     存储过程名称：up_townaudit、I_USERID：（VILLAGE|CUN）、I_TYPE：24。
   */
      let me = this
      let params = {
        taskId: data.TASK_ID,
        direction: 0,
        token: window.localStorage.getItem('token')
      }
      let params1 = {}
      let params3 = {
        accessCode: '0a709d649c314903a72225edb8bc8c2a',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: params
      }
      if (!data.TASK_ID) {
        params3.accessCode = '2c824ce489ff4cffaa0d77082e6fb648'
        params1.wfGuid = data.WF_GUID
        params1.entityRowGuid = data.ROW_GUID
        params1.viewParameter = {}
        params3.params = params1
      }
      const res = await FileServerProxy(params3)
      let newResData = JSON.parse(res.data.data)
      me.tableData = eval('(' + res.data.data + ')')
      newResData.SendData.forEach((newItem) => {
        if (newItem.PTNID == '-1')
          me.items.push({
            text: newItem.TEXT,
            WFNODEGUID: newItem.WFNODEGUID,
            dot: false,
            TNID: newItem.TNID,
            PTNID: newItem.PTNID,
            // 导航节点额外类名
            className: 'my-class',
            // 该导航下所有的可选项
            children: []
          })
      })
      let isNHApplyParam = {
        procName: 'up_townaudit',
        dtParams: JSON.stringify([{ I_USERID: data.BUILDTYPE == '14' ? data.VILLAGE : data.CUN, I_TYPE: '24' }])
      }
      let xcfycjtfnApply = {
        accessCode: '69db6bece3a7480592e2ec753d1e335e',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: isNHApplyParam
      }
      const resxcfycjtApply = await FileServerProxy(xcfycjtfnApply)
      let newdata = JSON.parse(resxcfycjtApply.data.data).Data
      newdata.forEach((item) => {
        me.ids++
        me.items[0].children.push({
          text: item.ST_NAME,
          id: me.ids,
          USERID: item.ST_ID,
          USERNAME: item.ST_NAME,
          WFNODEGUID: newResData.SendData[0].WFNODEGUID,
          WFNODENAME: newResData.SendData[0].TEXT,
          TEXT: item.ST_NAME,
          PTNID: newResData.SendData[0].TNID,
          TNID: me.ids + 1,
          ISUSER: 1,
          SINGLEASSIGN: false,
          WFNODETYPE: newResData.SendData[0].WFNODETYPE
        })
      })
    },
    repalceNodeUsers(res, req) {
      eval('(' + res.data.data + ')').SendData.forEach((item, index) => {
        this.items.forEach((item1) => {
          if (req.data && req.data.Data.length > 0) {
            item1.children = []
            req.data.Data.forEach((items) => {
              item1.children.push({
                text: items.USERNAME,
                id: index,
                USERID: items.USERID,
                USERNAME: items.USERNAME,
                WFNODEGUID: item.WFNODEGUID,
                WFNODENAME: item.WFNODENAME,
                TEXT: items.USERNAME,
                PTNID: item.PTNID,
                TNID: Number(item.TNID) + 1,
                ISUSER: item.ISUSER,
                SINGLEASSIGN: item.SINGLEASSIGN,
                WFNODETYPE: item.WFNODETYPE
              })
            })
          }
        })
      })
    },
    onClickLeft() {
      this.$router.back(-1)
    },
    QuerySignCallback: async function (node) {
      let USERIDS = []
      this.$route.query.TKDW.forEach((it, index) => {
        USERIDS.push(it.DEPTID)
      })
      let params4 = {
        accessCode: '69db6bece3a7480592e2ec753d1e335e',

        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: {
          procName: 'cs_z',
          dtParams: JSON.stringify([{ I_USERID: USERIDS.join(',') }]),
          token: window.localStorage.getItem('token')
        }
      }
      const req = await QuerySignCallback(params4)
      let data = eval('(' + req.data.data + ')').Data
      node.children = []
      data.forEach((it, index) => {
        this.ids++
        node.children.push({
          text: it.USERNAME,
          id: this.ids,
          USERID: it.USERID,
          USERNAME: it.USERNAME,
          WFNODEGUID: node.WFNODEGUID,
          WFNODENAME: node.text,
          TEXT: it.USERNAME,
          PTNID: node.TNID,
          TNID: this.ids + 1,
          ISUSER: 1,
          SINGLEASSIGN: false,
          WFNODETYPE: 2
        })
      })
    },
    handleData(data) {
      //
      // if(data.USERID==)
      //
      // this.indexData.push(data);
      console.log(this.indexData, 'this.indexData')
      if (
        this.$route.query.data.NODE_GUID === '{299D1B2C-4EDA-4963-AC66-E91B3403A49E}' ||
        this.$route.query.data.NODE_GUID == '{97E3145A-01B9-4CEE-AA4E-21CA9F0FF671}' ||
        this.$route.query.data.NODE_GUID === '{777D7530-351F-4BAA-8A28-9153C53A4BBE}' ||
        this.$route.query.data.NODE_GUID === '{EB7D42FE-320C-4A0A-9C98-3E9373898826}' ||
        this.$route.query.data.NODE_GUID == '{003E7696-65E6-432B-97A7-C95711D1D0E0}' ||
        this.$route.query.data.NODE_GUID === '{B6D1F2A1-ACF3-4894-948E-54B9BC1F059F}'
      ) {
        this.activeIds = [data.id]
        this.indexData = []
        this.indexData.push(data)
      } else {
        if (this.indexData.length > 0) {
          let status = false
          this.activeIds.forEach((item) => {
            if (item != data.id) {
              status = true
            }
          })
          if (status) {
            this.indexData.push(data)
          }
          let datas = []
          this.activeIds.forEach((item) => {
            this.indexData.forEach((items) => {
              if (item == items.id) {
                datas.push(items)
              }
            })
          })
          this.indexData = datas
        } else {
          this.indexData.push(data)
        }
      }
    },
    handleGoToNext: async function () {
      debugger
      //选图集选工匠环节需要保证选择既选择代办人又选择农户（代办环节）
      if (this.indexData.length > 0) {
        if (this.tableData1.length == 0 && !this.$route.query.Villgetrial && !this.$route.query.Villgetrial == '1') {
          let parms = {
            taskId: this.$route.query.data.TASK_ID,
            direction: 0,
            wfGuid: this.tableData.ProcInfo.WF_GUID,
            sendNodes: JSON.stringify(this.indexData),
            actionText: '同意',
            taskName: '浙政钉',
            token: window.localStorage.getItem('token')
          }
          let params3 = {
            accessCode: 'c52bcf7cf3fb42bb9fbcd9b91e97d411',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: parms
          }
          const res = await QuerySignCallback(params3)
          if (eval('(' + res.data.data + ')').Success == true) {
            let p = '',
              procName = 'cs_xgjbrhj'
            switch (this.$route.query.data.NODE_GUID) {
              //审批环节调用存储过程名称：cs_xgjbrhj
              case '{417EFF61-5FA8-44D6-A624-5B3D0F39B56C}': //镇街资格审核（经办人）
                p = 5
                break
              case '{0439EC7A-785D-4B5B-ADD4-11E2D320376E}': //镇街规划审核（经办人）
                p = 6
                break
              case '{5821E9EB-44B5-49AC-A659-6DF98B410B38}': //镇街农房审核（经办人）
                p = 7
                break
              case '{299D1B2C-4EDA-4963-AC66-E91B3403A49E}': //镇街资格审核（负责人）
                p = 81
                break
              case '{97E3145A-01B9-4CEE-AA4E-21CA9F0FF671}': //镇街规划审核（负责人）
                p = 82
                break
              case '{777D7530-351F-4BAA-8A28-9153C53A4BBE}': //镇街资格审核（负责人）
                p = 83
                break
              case '{9766D96E-8B85-481F-B514-C0B21CF4DC3A}': //镇街政府审核
                p = 70
                break
              //四到场竣工验收环节调用存储过程名称：cs_xgsdcjbrhj
              case '{5CC13346-8C53-4A37-989D-932716248754}': //竣工验收镇街资格审核（经办人）
                p = 8
                procName = 'cs_xgsdcjbrhj'
                break
              case '{74864380-8590-4F8B-BD75-942E08F04D81}': //竣工验收镇街规划审核（经办人）
                p = 9
                procName = 'cs_xgsdcjbrhj'
                break
              case '{7C289E35-88FC-4002-9B88-ED6F472CA872}': //竣工验收镇街农房审核（经办人）
                p = 10
                procName = 'cs_xgsdcjbrhj'
                break
              case '{EB7D42FE-320C-4A0A-9C98-3E9373898826}': //竣工验收镇街资格审核（负责人）
                p = 61
                procName = 'cs_xgsdcjbrhj'
                break
              case '{003E7696-65E6-432B-97A7-C95711D1D0E0}': //竣工验收镇街规划审核（负责人）
                p = 62
                procName = 'cs_xgsdcjbrhj'
                break
              case '{B6D1F2A1-ACF3-4894-948E-54B9BC1F059F}': //竣工验收镇街农房审核（经办人）
                p = 63
                procName = 'cs_xgsdcjbrhj'
                break
              case '{41EE42C1-2F52-45C5-A05C-D2D3160DCE23}': //竣工验收镇街政府审核
                p = 65
                break
              //四到场镇街审核环节调用存储过程名称：cs_xgzjsfh
              case '{67241083-CA60-43FC-B1C1-1F4A2D133184}': //现场踏勘2
                p = 50
                procName = 'cs_xgzjsfh'
              case '{5E1AD806-7824-4196-8ADF-E231A8704FD3}': //现场踏勘1
                p = 51
                procName = 'cs_xgzjsfh'
                break
              case '{646A4D45-00AC-4EA9-98AE-C5E704740BC1}': //申请放样  镇街审核
                p = 52
                procName = 'cs_xgzjsfh'
                break
              case '{D9C76DDF-7A07-4F5F-A9F2-FD597C715481}': //基槽验线  镇街审核
                p = 53
                procName = 'cs_xgzjsfh'
                break
              case '{BFF3BE52-75D4-4C53-B5E9-9144E35E7617}': //一层立模  镇街审核
                p = 54
                procName = 'cs_xgzjsfh'
                break
              default:
                break
            }
            if (p) {
              let paer = {
                procName: procName,
                dtParams: JSON.stringify([
                  {
                    I_PROC_GUID: this.$route.query.data.PROC_GUID,
                    I_TYPE: p,
                    I_ROW_GUID: this.$route.query.data.ROW_GUID,
                    I_PKID: this.$route.query.data.PKID
                  }
                ]),
                token: window.localStorage.getItem('token')
              }
              let params4 = {
                accessCode: '69db6bece3a7480592e2ec753d1e335e',

                cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
                params: paer
              }
              const req = await QuerySignCallback(params4)
            }
            let I_TYPE = ''
            if (
              this.$route.query.data.NODE_GUID == '{299D1B2C-4EDA-4963-AC66-E91B3403A49E}' ||
              this.$route.query.data.NODE_GUID == '{97E3145A-01B9-4CEE-AA4E-21CA9F0FF671}' ||
              this.$route.query.data.NODE_GUID == '{777D7530-351F-4BAA-8A28-9153C53A4BBE}'
            ) {
              I_TYPE = 85
            }
            if (
              this.$route.query.data.NODE_GUID == '{EB7D42FE-320C-4A0A-9C98-3E9373898826}' ||
              this.$route.query.data.NODE_GUID == '{003E7696-65E6-432B-97A7-C95711D1D0E0}' ||
              this.$route.query.data.NODE_GUID == '{B6D1F2A1-ACF3-4894-948E-54B9BC1F059F}'
            ) {
              I_TYPE = 65
            }
            if (I_TYPE) {
              let paer1 = {
                procName: procName,
                dtParams: JSON.stringify([
                  {
                    I_PROC_GUID: this.$route.query.data.PROC_GUID,
                    I_TYPE: I_TYPE,
                    I_ROW_GUID: this.$route.query.data.ROW_GUID,
                    I_PKID: this.$route.query.data.PKID
                  }
                ]),
                token: window.localStorage.getItem('token')
              }
              let params1 = {
                accessCode: '69db6bece3a7480592e2ec753d1e335e',

                cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
                params: paer1
              }
              const req = await QuerySignCallback(params1)
            }
            this.$toast.success('成功！')
            // this.$notify({ type: 'success', message: '成功！' });
            setTimeout(() => {
              this.$router.push({
                path: '/FeatureList'
              })
            }, 500)
          }
          debugger
          //wjh 2023/3/21  在现场踏勘、乡镇人民政府环节修改地图的状态
          if (
            this.$route.query.data &&
            this.$route.query.data.WF_GUID == '{9FF1C524-B55F-4A45-83B3-6EA46CF32092}' &&
            (this.$route.query.data.NODE_GUID == '{5E1AD806-7824-4196-8ADF-E231A8704FD3}' ||
              this.$route.query.data.NODE_GUID == '{67241083-CA60-43FC-B1C1-1F4A2D133184}' ||
              this.$route.query.data.NODE_GUID == '{9766D96E-8B85-481F-B514-C0B21CF4DC3A}')
          ) {
            let pram = new Promise(async (resolve) => {
              // 竣工验收乡镇人民政府发送结束调用
              if (this.$route.query.data.NODE_GUID == '{9766D96E-8B85-481F-B514-C0B21CF4DC3A}') {
                const res22 = await GJDBFunction2('get_gjcjxmsj', [{ get_gjcjxmsj: this.$route.query.data.ROW_GUID }])
                let params = {
                  ID: res22[0].ID,
                  commencementtime: res22[0].COMMENCEMENTTIME,
                  completiontime: res22[0].COMPLETIONTIME,
                  houseapplicant: res22[0].HOUSEAPPLICANT,
                  construcitonaddress: res22[0].CONSTRUCITONADDRESS,
                  Planningpermit: res22[0].PLANNINGPERMIT,
                  buildstorey: res22[0].BUILDSTOREY,
                  buildarea: res22[0].BUILDAREA,
                  craftsmancode: res22[0].CRAFTSMANCODE,
                  city: res22[0].CITY,
                  county: res22[0].COUNTY,
                  town: res22[0].TOWN,
                  village: res22[0].VILLAGE,
                  phone: res22[0].PHONE,
                  housebuilding: res22[0].HOUSEBUILDING,
                  rowGuid: res22[0].ROWGUID,
                  applytime: res22[0].APPLYTIME,
                  years: res22[0].YEARS,
                  contractid: res22[0].CONTRACTID,
                  isWhole: res22[0].ISWHOLE,
                  isCompleted: res22[0].ISCOMPLETED,
                  projectAmount: res22[0].PROJECTAMOUNT,
                  isOnline: res22[0].ISONLINE
                }
                const res = await houseCraftsmanprojectSave(params)
              }
            })
            pram.then((res) => {
              this.ifMapApplyEdit()
            })
          }
          // if(window.g.IfMapEnabled=="1"&&(this.indexData[0].WFNODEGUID=="{9FF1C524-B55F-4A45-83B3-6EA46CF32092}")){
          //     this.ifMapApplyEdit();
          // }
          this.$toast.success('成功！')
          //调用何银毫接口
          // this.$notify({ type: 'success', message: '成功！' });
          setTimeout(() => {
            this.$router.push({
              path: '/FeatureList'
            })
          }, 1000)
        }
        //村预审
        if (this.tableData1.length == 0 && this.$route.query.Villgetrial && this.$route.query.Villgetrial == '1') {
          //先更新字段状态
          var TaskId = ''
          if (!JSON.parse(this.$route.query.data).TASK_ID) {
            let params = {
              accessCode: '3ec88931e2bf429d9ceadff8697b6772',
              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: {
                bizGuid: JSON.parse(this.$route.query.data).BIZGUID,
                wfGuid: JSON.parse(this.$route.query.data).WF_GUID,
                entityRowGuid: JSON.parse(this.$route.query.data).ROW_GUID,
                token: window.localStorage.getItem('token')
              }
            }
            const resCreate = await FileServerProxy(params)
            let resCreateData = JSON.parse(resCreate.data.data)
            TaskId = resCreateData.TaskId
          }
          let parms = {
            taskId: JSON.parse(this.$route.query.data).TASK_ID ? JSON.parse(this.$route.query.data).TASK_ID : TaskId,
            direction: 0,
            wfGuid: JSON.parse(this.$route.query.data).WF_GUID,
            sendNodes: JSON.stringify(this.indexData),
            actionText: '同意',
            taskName: '浙政钉',
            token: window.localStorage.getItem('token')
          }
          let params3 = {
            accessCode: 'c52bcf7cf3fb42bb9fbcd9b91e97d411',
            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: parms
          }
          const res = await QuerySignCallback(params3)
          if (eval('(' + res.data.data + ')').Success == true) {
            //先更新字段状态
            let formData2 = [
              {
                PKID: JSON.parse(this.$route.query.data).PKID,
                row_guid: JSON.parse(this.$route.query.data).ROW_GUID,
                SBZT: '已上报'
              }
            ]
            let parms = {
              dataGuid: 'b68a5f59-7527-4cb8-bd8a-9b5451bb2d50',
              strParams: JSON.stringify(formData2)
            }
            let paramsendMEssage = {
              accessCode: '77ad6c1591e54d4fbc45ecc90374a2a2',
              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: parms
            }
            const res1 = await QuerySignCallback(paramsendMEssage)
            if (JSON.parse(res1.data.data).Success == true) {
              setTimeout(() => {
                this.$router.push({
                  path: '/FeatureList'
                })
              }, 500)
            }
          }
        }
      } else {
        this.$toast.fail('请选择发送的人员!')
      }
      //发送短信
      if (this.$route.query && this.$route.query.isrmzfzs == '1') {
        //现场放养申请
        //调用存储过程获取人员手机号
        var temp = ''
        var strMessqge = this.$route.query.data.CERTIFICATECODE + ',' + this.$route.query.data.DBRSFZH + ',' + this.$route.query.data.GJID
        let paerssend = {
          procName: 'message',
          dtParams: JSON.stringify([{ I_USERID: strMessqge, I_TYPE: 4 }]),
          token: window.localStorage.getItem('token')
        }
        let paramsendMEssage = {
          accessCode: '69db6bece3a7480592e2ec753d1e335e',

          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: paerssend
        }
        const reqwmsg = await QuerySignCallback(paramsendMEssage)
        const JSONSend = JSON.parse(reqwmsg.data.data)
        if (JSONSend && JSONSend.Data && JSONSend.Data.length > 0) {
          JSONSend.Data.forEach((phone) => {
            let paramdf = {
              mobiles: phone.MOBILETEL,
              templateId: 'c91009acf7fe490f9e60556d1164de60',

              accessCode: '11b5cfe531954d94bb924c856e63a99b'
            }
            // 发送短信通知
            sendBusinessMessage(paramdf)
          })
        }
      }
    },
    handle2: async function (data, data1) {
      let parms = {
        bizGuid: '53f76168-18bb-4ef9-96cf-70dbacd12000',
        wfGuid: '{9FF1C524-B55F-4A45-83B3-6EA46CF32092}',
        entityRowGuid: data,
        token: window.localStorage.getItem('token')
      }
      const res = await CreateProcess(parms)
      //成功后调用3接口完成
      this.handle3(data, res.data.TaskId, data1)
    },
    handle3: async function (data, data2, data1) {
      let parms = {
        taskId: data2,
        direction: 0,
        wfBoxGuid: '53f76168-18bb-4ef9-96cf-70dbacd12000',
        wfGuid: '{9FF1C524-B55F-4A45-83B3-6EA46CF32092}',
        sendNodes: JSON.stringify(data1),
        entityRowGuid: data,
        actionText: '',
        taskName: '',
        token: window.localStorage.getItem('token')
      }
      let params3 = {
        accessCode: 'c52bcf7cf3fb42bb9fbcd9b91e97d411',

        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: parms
      }
      const res = await QuerySignCallback(params3)
      this.$toast.success('保存成功！')
      // this.$notify({ type: 'success', message: '保存成功！' });
    },
    //修改上图状态
    ifMapApplyEdit: async function () {
      var type = ''
      var spzt = ''
      try {
        //现场踏勘
        if (
          this.$route.query.data &&
          this.$route.query.data.WF_GUID == '{9FF1C524-B55F-4A45-83B3-6EA46CF32092}' &&
          (this.$route.query.data.NODE_GUID == '{5E1AD806-7824-4196-8ADF-E231A8704FD3}' || this.$route.query.data.NODE_GUID == '{67241083-CA60-43FC-B1C1-1F4A2D133184}')
        ) {
          type = 'XCTK'
          spzt = 'SPZ'
        }
        //乡镇人民政府审核
        if (this.$route.query.data && this.$route.query.data.WF_GUID == '{9FF1C524-B55F-4A45-83B3-6EA46CF32092}' && this.$route.query.data.NODE_GUID == '{9766D96E-8B85-481F-B514-C0B21CF4DC3A}') {
          type = 'XCTK'
          spzt = 'SPWC'
        }
        var parameters = {
          f: 'json',
          outFields: '*',
          where: `sqbh='${this.$route.query.data.ROW_GUID}'`
        }
        var result = await IfMapToResult(parameters)
        if (result && result.data && result.data.features && result.data.features.length > 0) {
          var formData = new FormData()
          formData.append('updates', JSON.stringify([{ attributes: { objectid: result.data.features[0].attributes.objectid, stagetype: type, SPZT: spzt } }]))
          formData.append('f', 'json')
          await IfMapToApplyEdit(formData)
        }
      } catch (e) {}
      // if(data=="{FEF0E7B0-F048-42E0-998E-06387B0D03DB}"){
      //   type="现场放样"
      // }
      // if(data=="{F81FCB82-7196-4E94-BFF5-159E1CEBEFF8}"){
      //   type="基槽验线"
      // }
      // if(data=="{10BAEA52-EDDE-48C7-97AD-C211D272010E}"){
      //   type="一层立模"
      // }
      // if(data=="{C89D1E12-1303-482F-BB9E-45457905C759}"){
      //   type="竣工验收"
      // }
      // var parameters = {
      //   f: "json",
      //   outFields: "*",
      //   where: `sqbh='${this.$route.query.data.ROW_GUID}'`,
      //  };
      // var   result=  await IfMapToResult(parameters);
      // if(result&&result.data&&result.data.features&&result.data.features.length>0){
      //   var  formData=new  FormData();
      //   formData.append("updates",JSON.stringify([{ "attributes": { "objectid": result.data.features[0].attributes.objectid,  "stagetype": type }}]));
      //   formData.append("f","json");
      //   await this.IfMapToApplyEdit();
      // }
    }
  },
  mounted() {
    debugger
    //接收浙里办传来的参数
    if (this.$route.query.data2 && this.$route.query.data1) {
      this.tableData1 = this.$route.query.data2
      this.code1 = this.$route.query.data1
      this.getData('')
    } else if (this.$route.query.datazg) {
      this.tableData1 = this.$route.query.datazg
      this.code1 = this.$route.query.datazg
      this.getData(this.$route.query.datazg.TASK_ID ? this.$route.query.datazg.TASK_ID : '')
    } else if (this.$route.query.Villgetrial && this.$route.query.Villgetrial == '1') {
      debugger
      this.getCunYUshen(JSON.parse(this.$route.query.data))
    } else {
      try {
        this.getData(this.$route.query.data.TASK_ID ? this.$route.query.data.TASK_ID : '')
      } catch (err) {}
    }
  }
}
</script>
<style lang="scss" scoped>
.TreeSelect1 {
  height: 100vh;
  background: #fff;
  font-size: 0.2em;
}
</style>
